package main.java.sort.NodeSort;

import main.java.structure.TreeNode;

import java.util.List;

/**
 * @Author: 郑国荣
 * @Date: 2024-04-01-13:24
 * @Description:
 */
public class inOrderTraversal {
    public static void main(String[] args) {
//        新建一个树,前序遍历：4 5 6 7 3 2 1，排序后前序遍历;4 5 6 7 3 2 1 中序遍历：6 5 7 4 2 3 1
        TreeNode treeNode = new TreeNode(4,
                                new TreeNode(5,
                                        new TreeNode(6), new TreeNode(7)),
                                new TreeNode(3,
                                        new TreeNode(2), new TreeNode(1)));
        List<Integer> list = new inOrderTraversal().test(treeNode);
        for (Integer integer : list) {
            System.out.println(integer);
        }
    }

    private List<Integer> test(TreeNode root) {
        return root.inorderTraversal(root);
    }
}
